package com.css.fxfzfxqh.modules.vulnerabilityData.verify;

import cn.afterturn.easypoi.excel.entity.result.ExcelVerifyHandlerResult;
import cn.afterturn.easypoi.handler.inter.IExcelVerifyHandler;
import com.css.fxfzfxqh.modules.vulnerabilityData.entity.WaterWorksEntity;
import com.css.fxfzfxqh.util.PlatformObjectUtils;
import org.springframework.stereotype.Component;

@Component
public class WaterWorksExcelVerifyHandler implements IExcelVerifyHandler<WaterWorksEntity> {
    @Override
    public ExcelVerifyHandlerResult verifyHandler(WaterWorksEntity waterWorksEntity) {

        ExcelVerifyHandlerResult result = new ExcelVerifyHandlerResult(true);
        StringBuilder message = new StringBuilder("");

        if (PlatformObjectUtils.isEmpty(waterWorksEntity.getCwName())) {
            result.setSuccess(false);
            message.append("水厂名称 不能为空！");
        }
        if (PlatformObjectUtils.isEmpty(waterWorksEntity.getLongitude())) {
            result.setSuccess(false);
            message.append("经度 不能为空！");
        }
        if (PlatformObjectUtils.isEmpty(waterWorksEntity.getLatitude())) {
            result.setSuccess(false);
            message.append("纬度 不能为空！");
        }
        if (PlatformObjectUtils.isEmpty(waterWorksEntity.getId())) {
            result.setSuccess(false);
            message.append("建筑物编码 不能为空！");
        }
        if (PlatformObjectUtils.isEmpty(waterWorksEntity.getBuildingName())) {
            result.setSuccess(false);
            message.append("建筑物名称 不能为空！");
        }
        if (PlatformObjectUtils.isEmpty(waterWorksEntity.getType())) {
            result.setSuccess(false);
            message.append("结构类型 不能为空！");
        }
        if (PlatformObjectUtils.isEmpty(waterWorksEntity.getFloors())) {
            result.setSuccess(false);
            message.append("建筑层数 不能为空！");
        }
        if (PlatformObjectUtils.isEmpty(waterWorksEntity.getArea())) {
            result.setSuccess(false);
            message.append("建筑面积 不能为空！");
        }
        return result;
    }
}
